package com.wanyangproject.androidlearning.designMode.factory.abstractFacotry;

public class MyAbstractFactory extends AbstractFactory {

    public static<T> Animal createAnimal(Class<T> tClass){
        try {
            Animal animal = (Animal) Class.forName(tClass.getName()).newInstance();
            return animal;
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Animal createAnimalFactory() {
        return new HourseAnimal();
    }


    @Override
    public Botany createBotany() {
        return new AppleTreePlant();
    }



}
